package com.maven.orm.hibernate;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ResponseBody;

import com.jqgrid.entity.Student;


//封装controller的基本操作
public interface ControllerBase<T>{
	
	/**
	 * 保存
	 * @param obj
	 * @return
	 */
	public @ResponseBody String save(T obj);
	
	/**
	 * 更新
	 * @param obj
	 * @return
	 */
	public @ResponseBody String update(T obj);
	
	/**
	 * 删除
	 * @param id
	 * @return
	 */
	public @ResponseBody String delete(String id);
	
	/**
	 * 根据ID返回实体
	 * @param id
	 * @return
	 */
	public @ResponseBody T findById(String id);
	
	/**
	 * 根据多个ID删除记录
	 * @param idList
	 * @return
	 */
	public @ResponseBody String deleteByIdList(Integer[] idList);
	
	
	/**
	 * 带查询条件的分页查询
	 * @param hql
	 * @param paras
	 * @param beginIndex
	 * @param pageSize
	 * @return
	 */
	public ResponseEntity<String> findParasByPageToJSON(String page,String rows);
	
	/**
	 * 通用 CUD 操作
	 * @param obj 传过来的对象
	 * @param oper
	 * @return
	 */
	public @ResponseBody String dataOper(T obj,String oper);
	
	/**
	 * excel导出
	 * @return
	 */
	public String excelExport(HttpServletRequest request,HttpServletResponse response)throws Exception;
	
	/**
	 * pdf导出
	 * @return
	 */
	public String pdfExport(HttpServletRequest request,HttpServletResponse response)throws Exception;
}
